Sensor Fusion for Kinetis MCUs (ISSDK/KSDK version)
status.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016, NXP Semiconductor
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without modification,
6  * are permitted provided that the following conditions are met:
7  *
8  * o Redistributions of source code must retain the above copyright notice, this list
9  * of conditions and the following disclaimer.
10  *
11  * o Redistributions in binary form must reproduce the above copyright notice, this
12  * list of conditions and the following disclaimer in the documentation and/or
13  * other materials provided with the distribution.
14  *
15  * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
16  * contributors may be used to endorse or promote products derived from this
17  * software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #ifndef SENSOR_FUSION_STATUS_H_
32 #define SENSOR_FUSION_STATUS_H_
33 
34 
35 /*! \file status.h
36  \brief Application-specific status subsystem
37 
38  Applications may change how they choose to display status information.
39  The default implementation here uses LEDs on NXP Freedom boards.
40  You may swap out implementations as long as the "Required" methods and states
41  are retained.
42 */
43 /// StatusSubsystem() provides an object-like interface for communicating status to the user
44 typedef struct StatusSubsystem {
45  // Required internal states
46  fusion_status_t previous; ///< Previous status state - fusion_status_t is defined in sensor_fusion.h
47  fusion_status_t status; ///< Current status
48  fusion_status_t next; ///< Pending status change
49  // Required methods
50  ssSetStatus_t *set; ///< change status immediately - no delay
51  ssSetStatus_t *queue; ///< queue status change for next regular interval
52  ssUpdateStatus_t *update; ///< make pending status active/visible
53  ssUpdateStatus_t *test ; ///< unit test which simply increments to next state
54  // application-specific internal variables
55  uint8_t toggle; ///< This implementation can change LED color and have either solid/toggle
57 
58 /// initializeStatusSubsystem() should be called once at startup to initialize the
59 /// data structure and to put hardware into the proper state for communicating status.
61  StatusSubsystem *pStatus ///< pointer to the status subsystem
62 );
63 
64 #endif /* SENSOR_FUSION_STATUS_H_ */
ssUpdateStatus_t * test
unit test which simply increments to next state
Definition: status.h:53
fusion_status_t status
Current status.
Definition: status.h:47
void initializeStatusSubsystem(StatusSubsystem *pStatus)
initializeStatusSubsystem() should be called once at startup to initialize the data structure and to ...
Definition: status.c:185
fusion_status_t previous
Previous status state - fusion_status_t is defined in sensor_fusion.h.
Definition: status.h:46
StatusSubsystem() provides an object-like interface for communicating status to the user...
Definition: status.h:44
struct StatusSubsystem StatusSubsystem
StatusSubsystem() provides an object-like interface for communicating status to the user...
uint8_t toggle
This implementation can change LED color and have either solid/toggle.
Definition: status.h:55
void( ssUpdateStatus_t)(struct StatusSubsystem *pStatus)
void( ssSetStatus_t)(struct StatusSubsystem *pStatus, fusion_status_t status)
ssUpdateStatus_t * update
make pending status active/visible
Definition: status.h:52
fusion_status_t
Application-specific serial communications system.
fusion_status_t next
Pending status change.
Definition: status.h:48
ssSetStatus_t * queue
queue status change for next regular interval
Definition: status.h:51